$(document)
		.ready(
				function() {
					var clientHeight = top.document.body.clientHeight - 200;
					var clientWidth = document.body.clientWidth - 100;
					$("button").button();
					var varname = $("#varname"), varcode = $("#varcode"), parentid = $("#parentid"), unitid = $("#unitid"), remark = $("#remark"), allFields = $(
							[]).add(varname).add(varcode).add(parentid).add(
							unitid).add(remark);
					$("#add").click(function() {
						$("#addinfo").dialog("open");
					});
					$("#mod").click(function() {
					});
					$("#del").click(function() {
					});
					$("#validdate").datepicker($.datepicker.regional["zh-CN"]);
					$("#addinfo")
							.dialog(
									{
										autoOpen : false,
										height : clientHeight,
										width : clientWidth,
										modal : true,
										buttons : {
											"Submit" : function() {
												var bValid = true;
												allFields
														.removeClass("ui-state-error");
												bValid = bValid
														&& checkLength(varname,
																"部门名称", 1, 16);
												bValid = bValid
														&& checkLength(varcode,
																"部门编号", 6, 16);
												bValid = bValid
														&& checkLength(
																parentid,
																"上级部门", 1, 16);
												bValid = bValid
														&& checkLength(unitid,
																"单位", 1, 16);
												if (bValid) {
													$(this).dialog("close");
												}
											},
											Cancel : function() {
												$(this).dialog("close");
											}
										}
									});
				});